home *** CD-ROM | disk | FTP | other *** search
/ TOS Silver 2000 / TOS Silver 2000.iso / Tools / RSM31D / modules / rsm2cs / ciconini.c next >
Encoding:
C/C++ Source or Header  |  1999-10-08  |  2.6 KB  |  77 lines

  1. /*************************************************************
  2.  *                                                           *
  3.  *     Beispiele für cicon_init() und cicon_exit()           *
  4.  *     Autor: Armin Diedering                                *
  5.  *     WWW: http://www.Diedering.de                          *
  6.  *                                                           *
  7.  *************************************************************/
  8.  
  9. #include <portab.h>
  10. #include <gemfast.h>
  11.  
  12.  
  13. /* Folgende Funktionen werden Benötigt */
  14.  
  15. WORD CountOfPlanes();        /* liefert da Anzahl der Planes der aktuellen  */
  16.                                     /*    Auflösung zurück                            */
  17.  
  18. WORD CanCicon();                /* gibt Auskunft, ob das System CICONs kann    */
  19.  
  20. WORD IsMagiC();                /* Ist MagiC das OS ?                          */
  21.  
  22.  
  23. /* Jetzt gehts aber los */
  24.  
  25. long rs_ciconinit(CICONBLK *ciconblks, int ncib, OBJECT *objects, int nobj)
  26. {
  27.     if(CanCicon())
  28.     {
  29.         if(IsMagiC())
  30.         {
  31.             while(ncib--)                                  /* siehe rsm2cs.hyp         */
  32.             {
  33.                 CICON *cicon = ciconblks->mainlist;
  34.                 CICON *found = cicon;
  35.                 WORD planes = 0;
  36.                 while(cicon)                                /* passende Farbzahl suchen */
  37.                 {
  38.                     if(cicon->num_planes <= CountOfPlanes()) /* kann das OS dieses Icon? */
  39.                     {
  40.                         if(cicon->num_planes > planes)        /* sind es mehr Planes als  */
  41.                         {                                     /* ich schon gefunden habe? */
  42.                             found        = cicon;
  43.                             planes    = found->num_planes;      /* das merk ich mir         */
  44.                         }
  45.                     }
  46.                     cicon = cicon->next_res;                 /* nächste Farbzahl         */
  47.                 }
  48.                 ciconblks->mainlist = found;                /* gefundesnes setzen       */
  49.                 ciconblks++;                                /* nächstes Icon            */
  50.             }
  51.         }
  52.         else
  53.         {
  54.             /* Hier wirds jetz aber kompliziert. man muß CICON für CICON durchgehen. */
  55.             /* Dabei sollte man erst einmal die passende Farbzahl (ähnlich wie bei   */
  56.             /* MagiC s.o.) suchen und setzen. Dann müssen die gefundenen Bilddaten,  */
  57.             /* die ja im Standrd-Format vorliegen in das geräteabhängige Format      */
  58.             /* gewandelt werden.                                                     */
  59.             /* wie das zu bewerkstelligen ist überlasse ich eurer Fantasie ;-)       */
  60.         }
  61.     }
  62.     else                    /* das System kann gar keine CICONs */
  63.     {
  64.         while(nobj--)  /* dann alle CICONs in ICONs ändern */
  65.         {
  66.             if((objects->ob_type & 0xff) == G_CICON)
  67.                 objects->ob_type = (objects->ob_type & ~0xff) | G_ICON;
  68.             objects++;
  69.         }
  70.     }
  71.     return(0);
  72. }
  73.  
  74. void rs_ciconexit(long deskriptor)
  75. {
  76. }
  77.